package com.hundsun.yr.universal.p2p.interactor.impl;

import android.content.Context;

import com.hundsun.mobile.zwgt.R;
import com.hundsun.yr.universal.library.data.HSSharedPreferences;
import com.hundsun.yr.universal.library.view.itemview.BasicItemViewH;
import com.hundsun.yr.universal.library.view.itemview.SettingData;
import com.hundsun.yr.universal.library.view.itemview.SettingViewItemData;
import com.hundsun.yr.universal.p2p.bean.UserInfo;
import com.hundsun.yr.universal.p2p.config.Config;
import com.hundsun.yr.universal.p2p.interactor.base.AutomaticBidAdvanceSettingInteractor;

import java.util.ArrayList;
import java.util.List;


/**
 * @version V1.0
 * @Title: SettingInteractorImpl.java
 * @Description: TODO(用一句话描述该文件做什么)
 * @date 2016-1-4 上午10:04:45
 * @author:hejun.shen
 * @email:shenhj15971@hundsun.com
 * @replace author:
 * @replace date:
 */
public class AutomaticBidAdcancedSettingInteractorImpl implements AutomaticBidAdvanceSettingInteractor {

    private SettingViewItemData mItemViewData = null;
    private SettingData mItemData = null;
    private HSSharedPreferences hsUserInfoSharedPreferences = null;
    private HSSharedPreferences hsConfigInfoSharedPreferences = null;

    /**
     * 获取新增设置信息
     *
     * @param context
     * @return
     */
    @SuppressWarnings("deprecation")
    @Override
    public List<SettingViewItemData> getExpandItemData(Context context) {
        // TODO Auto-generated method stub
        hsUserInfoSharedPreferences = new HSSharedPreferences(context, Config.SPPath.file_userLoginedInfo);
        hsConfigInfoSharedPreferences = new HSSharedPreferences(context, Config.SPPath.file_configInfo);
        List<SettingViewItemData> mListData = new ArrayList<SettingViewItemData>();

        //投资金额
        mItemViewData = new SettingViewItemData();
        mItemData = new SettingData();
        mItemData.setTitle(context.getString(R.string.investment_amount));
        mItemData.setSubTitle(context.getString(R.string.no_all));
        mItemData.setSubTitleColor(context.getResources().getColor(R.color.item_view_titleColor));
        mItemData.setTitleColor(context.getResources().getColor(R.color.item_view_subtitleColor));
        mItemViewData.setData(mItemData);
        mItemViewData.setItemView(new BasicItemViewH(context));
        mListData.add(mItemViewData);

        //项目类型
        mItemViewData = new SettingViewItemData();
        mItemData = new SettingData();
        mItemData.setTitle("项目类型");
        mItemData.setSubTitle(context.getString(R.string.no_all));
        mItemData.setSubTitleColor(context.getResources().getColor(R.color.item_view_titleColor));
        mItemData.setTitleColor(context.getResources().getColor(R.color.item_view_subtitleColor));
        mItemViewData.setData(mItemData);
        mItemViewData.setItemView(new BasicItemViewH(context));
        mListData.add(mItemViewData);

        //还款方式
        mItemViewData = new SettingViewItemData();
        mItemData = new SettingData();
        mItemData.setTitle(context.getString(R.string.repayment_method));
        mItemData.setSubTitle(context.getString(R.string.no_all));
        mItemData.setSubTitleColor(context.getResources().getColor(R.color.item_view_titleColor));
        mItemData.setTitleColor(context.getResources().getColor(R.color.item_view_subtitleColor));
        mItemViewData.setData(mItemData);
        mItemViewData.setItemView(new BasicItemViewH(context));
        mListData.add(mItemViewData);

//        //投资利率
//        mItemViewData = new SettingViewItemData();
//        mItemData = new SettingData();
//        mItemData.setTitle(context.getString(R.string.investment_rate));
//        mItemData.setSubTitle(context.getString(R.string.no_all));
//        mItemData.setSubTitleColor(context.getResources().getColor(R.color.item_view_titleColor));
//        mItemData.setTitleColor(context.getResources().getColor(R.color.item_view_subtitleColor));
//        mItemViewData.setData(mItemData);
//        mItemViewData.setItemView(new BasicItemViewH(context));
//        mListData.add(mItemViewData);


        //投资期限
        mItemViewData = new SettingViewItemData();
        mItemData = new SettingData();
        mItemData.setTitle(context.getString(R.string.investment_duration));
        mItemData.setSubTitle(context.getString(R.string.no_all));
        mItemData.setSubTitleColor(context.getResources().getColor(R.color.item_view_titleColor));
        mItemData.setTitleColor(context.getResources().getColor(R.color.item_view_subtitleColor));
        mItemViewData.setData(mItemData);
        mItemViewData.setItemView(new BasicItemViewH(context));
        mListData.add(mItemViewData);

        //年华收益率
        mItemViewData = new SettingViewItemData();
        mItemData = new SettingData();
        mItemData.setTitle(context.getString(R.string.expected_interestrate));
        mItemData.setSubTitle(context.getString(R.string.no_all));
        mItemData.setSubTitleColor(context.getResources().getColor(R.color.item_view_titleColor));
        mItemData.setTitleColor(context.getResources().getColor(R.color.item_view_subtitleColor));
        mItemViewData.setData(mItemData);
        mItemViewData.setItemView(new BasicItemViewH(context));
        mListData.add(mItemViewData);

        return mListData;
    }

    @Override
    public boolean isLogin(Context context) {
        // TODO Auto-generated method stub
        hsUserInfoSharedPreferences = new HSSharedPreferences(context, Config.SPPath.file_userLoginedInfo);
        return hsUserInfoSharedPreferences.getBoolean(UserInfo.ISLOGIN);
    }

    @Override
    public String userLogo(Context context) {
        // TODO Auto-generated method stub
        hsUserInfoSharedPreferences = new HSSharedPreferences(context, Config.SPPath.file_userLoginedInfo);
        return hsUserInfoSharedPreferences.getShareProf(UserInfo.USER_LOGO);
    }

    @Override
    public String userName(Context context) {
        // TODO Auto-generated method stub
        hsUserInfoSharedPreferences = new HSSharedPreferences(context, Config.SPPath.file_userLoginedInfo);
        return hsUserInfoSharedPreferences.getShareProf(UserInfo.REALNAME);
    }

    @Override
    public String certNo(Context context) {
        // TODO Auto-generated method stub
        hsUserInfoSharedPreferences = new HSSharedPreferences(context, Config.SPPath.file_userLoginedInfo);
        return hsUserInfoSharedPreferences.getShareProf(UserInfo.CERT_NO);
    }
}
